<form nz-form [formGroup]="addEditForm">
  <nz-form-item>
    <nz-form-label nzFor="departmentname" nzRequired [nzSm]="6" [nzXs]="24">部门名称</nz-form-label>
    <nz-form-control [nzErrorTip]="combineTpl" [nzSm]="14" [nzXs]="24">
      <input id="departmentname" name="departmentname" formControlName="departmentname" nz-input placeholder="请输入部门名称" />
    </nz-form-control>
  </nz-form-item>

  <nz-form-item>
    <nz-form-label nzFor="state" nzRequired [nzSm]="6" [nzXs]="24">部门状态</nz-form-label>
    <nz-form-control [nzErrorTip]="combineTpl" [nzSm]="14" [nzXs]="24">
      <nz-radio-group formControlName="state">
        <label nz-radio [nzValue]="false">禁用</label>
        <label nz-radio [nzValue]="true">可用</label>
      </nz-radio-group>
    </nz-form-control>
  </nz-form-item>

  <nz-form-item>
    <nz-form-label nzFor="ordernum" nzRequired [nzSm]="6" [nzXs]="24">排序</nz-form-label>
    <nz-form-control [nzErrorTip]="combineTpl" [nzSm]="14" [nzXs]="24">
      <input id="ordernum" name="ordernum" formControlName="ordernum" nz-input placeholder="排序" />
    </nz-form-control>
  </nz-form-item>
</form>

<ng-template #combineTpl let-control>
  @if (control.hasError('message')) {
    {{ control.errors.message }}
  }
  @if (control.hasError('required')) {
    必填项
  }
</ng-template>
